package com.nidu.demo.mail.dto;

import com.nidu.demo.base.BaseCmd;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 邮件账号更新命令
 *
 * @author auto
 */
@Data
@Schema(description = "邮件账号更新命令")
@EqualsAndHashCode(callSuper = true)
public class MailAccountUpdateCmd extends BaseCmd {

    @NotNull(message = "主键ID不能为空")
    @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long id;

    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    @Size(max = 255, message = "邮箱长度不能超过255个字符")
    @Schema(description = "邮箱", requiredMode = Schema.RequiredMode.REQUIRED, example = "admin@example.com")
    private String mail;

    @NotBlank(message = "用户名不能为空")
    @Size(max = 255, message = "用户名长度不能超过255个字符")
    @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "admin")
    private String username;

    @Size(max = 255, message = "密码长度不能超过255个字符")
    @Schema(description = "密码", example = "password")
    private String password;

    @NotBlank(message = "SMTP服务器域名不能为空")
    @Size(max = 255, message = "SMTP服务器域名长度不能超过255个字符")
    @Schema(description = "SMTP 服务器域名", requiredMode = Schema.RequiredMode.REQUIRED, example = "smtp.example.com")
    private String host;

    @NotNull(message = "SMTP服务器端口不能为空")
    @Schema(description = "SMTP 服务器端口", requiredMode = Schema.RequiredMode.REQUIRED, example = "587")
    private Integer port;

    @Schema(description = "是否开启 SSL", example = "true")
    private Boolean sslEnable;

    @Schema(description = "是否开启 STARTTLS", example = "true")
    private Boolean starttlsEnable;

}
